/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package poker.geneticAlgorithm;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * A test run which runs the GA with the implicit selector/fitness func that the
 * indiviudal have the highest value of its genes added together.
 * 
 * 
 * @author Benjamin L. Brodie <blbrodie@gmail.com>
 */
public class TestRunWeightsGA {
    
    Selection<Individual<Double>> selection;
    Mutation<Individual<Double>> mutation;
    Crossover<Individual<Double>> crossover;
    PopulationOfWeights population;
    int totalEvaluations = 1000;
    int populationSize = 500;
    int indiviudalLength = 19;
    
    WeightsGA ga; 
    
    
    public TestRunWeightsGA(){
        List<Crossover<Individual<Double>>> crossovers = new ArrayList<Crossover<Individual<Double>>>();
        crossovers.add(new TwoPointCrossover());
        crossovers.add(new WholeArithmeticCrossover());
        crossover = new RandomCrossoverType<Individual<Double>>(crossovers);
        
        
        selection = new PokerGameSelection(5);
        mutation = new GaussianMutation(1.0, 0.003);
        
        population = new PopulationOfWeights(populationSize, indiviudalLength);
        ga = new WeightsGA(population, selection, crossover, mutation, totalEvaluations); 
    }
    
    public static void main(String[] args){
        TestRunWeightsGA runner = new TestRunWeightsGA();
        runner.go();
        
        
    }
    
    public void go(){
        population = ga.run();
        System.out.println(population);
        System.out.println("-----------------------------------");
    }
    
    
    
    
}
